import { defineStore } from 'pinia'

interface UserState {
  username: string | null;
}

export const userStore = defineStore('user', {
  state: (): UserState => {
    return {
      // 所有这些属性都将自动推断其类型
      username: null
    }
  },
  actions: {
    setUsername(this: UserState, newUsername: string) {
      this.username = newUsername
    }
  },
  persist: {
    enabled: true
  }
})
